home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.9 KB | 151 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 1 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //================================================================================
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- #ifndef BINDING_K
- #include "Binding.k"
- #endif
-
- // ----- Framework Includes -----
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWABOUT_H
- #include "FWAbout.h" //::FW_About()
- #endif
-
- #include "FWPrtIte.h" // FW_CPartFrameIterator
- #include "FWIters.h" // FW_CFrameFacetIterator
- #include "FWIdle.h" // FW_CIdler
- #include "SLMixOS.h" // FW_GetMainScreenBounds
-
- //==============================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Idling
- #endif
-
- FW_DEFINE_AUTO(CIdlingPart)
- //==============================================================================
- CIdlingPart::CIdlingPart(ODPart* odPart)
- : FW_CPart(odPart, FW_gInstance, kPartInfoID),
- fIdlingActive(TRUE),
- fIdler(NULL),
- fPresentation(NULL)
- {
- }
-
- //--------------------------------------------------------------------------------
- CIdlingPart::~CIdlingPart()
- {
- delete fIdler;
- }
-
- //--------------------------------------------------------------------------------
- void
- CIdlingPart::Initialize(Environment* ev) // Override
- {
- FW_CPart::Initialize(ev);
- FW_CSelection* selection = NULL;
- const ODType kMainPresentation = "Apple:Presentation:Idling";
- fPresentation = this->RegisterPresentation(ev, kMainPresentation, TRUE, selection);
- const ODIdleFrequency kIdleFreq = 10; // ticks
- fIdler = FW_NEW(FW_CIdler, (this, kIdleFreq));
- fIdler->RegisterIdle(ev);
- }
-
- //--------------------------------------------------------------------------------
- FW_CFrame*
- CIdlingPart::NewFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, FW_Boolean fromStorage) // Override
- {
- FW_UNUSED(presentation);
- FW_UNUSED(fromStorage);
- return FW_NEW(CIdlingFrame, (ev, odFrame, presentation, this));
- }
-
- //--------------------------------------------------------------------------------
- FW_CContent*
- CIdlingPart::NewPartContent(Environment* ev)
- {
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- FW_CWindow*
- CIdlingPart::NewDocumentWindow(Environment* ev)
- {
- FW_CRect screenBounds;
- ::FW_GetMainScreenBounds(screenBounds);
- screenBounds.Inset(FW_IntToFixed(3), FW_IntToFixed(3));
-
- return new FW_CWindow(ev,
- this,
- FW_CPart::gViewAsFrameToken,
- fPresentation,
- FW_CPoint(FW_IntToFixed(72), FW_IntToFixed(72)),
- screenBounds.TopLeft(),
- FW_kDocumentWindow);
- }
-
- //--------------------------------------------------------------------------------
- FW_Boolean
- CIdlingPart::DoIdle(Environment* ev, const FW_CNullEvent& theNullEvent)
- {
- FW_UNUSED(theNullEvent);
- FW_CPartFrameIterator iter(ev, this);
- for (CIdlingFrame* frame = (CIdlingFrame*)iter.First(ev);
- iter.IsNotComplete(ev);
- frame = (CIdlingFrame*)iter.Next(ev))
- {
- FW_CFrameFacetIterator facetIter(ev, frame);
- for (ODFacet* facet = facetIter.First(ev);
- facetIter.IsNotComplete(ev);
- facet = facetIter.Next(ev))
- {
- frame->MyToggleColor();
- frame->Draw(ev, facet, NULL);
- } // for facets
- } // for frames
- return true;
- }
-
- //--------------------------------------------------------------------------------
- void
- CIdlingPart::MyToggleIdling(Environment* ev)
- {
- fIdlingActive = ! fIdlingActive;
- fIdler->RegisterIdle(ev, fIdlingActive);
- }
-
- //--------------------------------------------------------------------------------
- FW_Boolean
- CIdlingPart::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent) // Override
- {
- FW_Boolean menuHandled = true;
- switch (theMenuEvent.GetCommandID(ev))
- {
- case kODCommandAbout:
- ::FW_About(ev, this, kAbout);
- break;
-
- default:
- menuHandled = false;
- }
- return menuHandled;
- }
-
-
-